//
//  StoneAPIManager.h
//  StoneAPI
//
//  Created by 陈小东 on 15/3/14.
//  Copyright (c) 2015年 _____stone_chenxiaodong_____. All rights reserved.
//

#import "AFHTTPRequestOperationManager.h"
#import <CoreLocation/CoreLocation.h>
#import "StoneModel.h"

#define kLOGIN_STATUS_CHANGED_NOTIFICATION @"kLOGIN_STATUS_CHANGED_NOTIFICATION"

typedef void(^SUCCESS_BLOCK)(id data);
typedef void(^FAIL_BLOCK)(NSError * error);
typedef void(^PROGRESS_BLOCK)(CGFloat percent,long long requestDidSendBytes);

typedef NS_ENUM(NSInteger, APICachePloy) {
    APICachePloy_Normal = 0, //先获取缓存数据。如果没有再获取服务器数据(默认)
    APICachePloy_Server = 1, //只获取服务器数据,获取成功会刷新本地缓存
    APICachePloy_Cache  = 2  //只获取缓存数据，如果没有会返回nil
};

#pragma mark -

@interface StoneAPIManager : AFHTTPRequestOperationManager{
    User * _currentUser;
}
@property(nonatomic, unsafe_unretained, readonly) User * currentUser;
@property(nonatomic, getter = isLogined, readonly) BOOL logined;//是否已经登录
/**
 *  使用本方法生成唯一的 API 管理类单例
 *
 *  @return 单例
 */
+ (instancetype)sharedManager;

//API地址
+ (NSString *)fetchAPIServerUrl;

@end

#pragma mark - 精品推荐

@interface StoneAPIManager (recommend)
- (void)actionRecommendSuccess:(SUCCESS_BLOCK)success
                       failure:(FAIL_BLOCK)failure;
@end


